import "./header.css";
import Scroll from "../../utils/scroll";

const TRANSITION_CLASSNAME = "header-transition";

class Header {
  constructor(
    changingEl,
    critical_point,
    scollContainer,
    eventEl = scollContainer
  ) {
    this.changingEl = changingEl;
    this.critical_point = critical_point;
    this.scollContainer = scollContainer;
    this.eventEl = eventEl;
    new Scroll(
      {
        critical_point,
        change: () => {
          this.change();
        },
        reset: () => {
          this.reset();
        },
      },
      scollContainer,
      eventEl
    );
  }

  change() {
    this.changingEl.classList.add(TRANSITION_CLASSNAME);
  }

  reset() {
    this.changingEl.classList.remove(TRANSITION_CLASSNAME);
  }
}

export { Header };
